package com.example.demo.mapper;

import com.example.demo.entity.deletebasic;
import com.example.demo.entity.faultmanage;
import com.example.demo.entity.m_suggestions;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface faultmanageMapper {
    @Insert("insert into view_faultmanage(wfkey,ukey,fname,fcode,fdescribe,fcategory,freportdate,fmaintaindate,flocation," +
            "flocationn,flocationnn,sitem,fseason) value(#{wfkey},#{ukey},#{fname},#{fcode},#{fdescribe},#{fcategory},#{freportdate}," +
            "#{fmaintaindate},#{flocation},#{flocationn},#{flocationnn},#{sitem},#{fseason})")
    @Options(useGeneratedKeys=true,keyProperty="fkey")
    public int insert(faultmanage faultmanage);

    @Update("update view_faultmanage set resetdate=#{resetdate} where fkey=#{fkey}")
    public int reset(int fkey,String resetdate);

    @Select("select resetdate from view_faultmanage where fkey=#{fkey}")
    public String selectResetdate(int fkey);

    @Select("select * from view_faultmanage")
    public List<faultmanage> query();

    @Update("update view_basicdata set estatus='停机' where wfkey=#{wfkey} and ukey=#{ukey}")
    public int estatused(int wfkey,String ukey);

    @Select("select wfkey,ukey from view_faultmanage where fkey=#{fkey}")
    public deletebasic selectwfu(int fkey);
    @Update("update view_basicdata set estatus='运行' where wfkey=#{wfkey} and ukey=#{ukey}")
    public int estatusing(deletebasic deletebasic);

    @Select("select suggestions,confidence from view_m_suggestions where fcode=#{fcode}")
    public List<m_suggestions> querysuggestions(int fcode);
}
